/**
 * Created by HZH
 * Date-Time: 2022-02-16
 */

import * as charts from 'echarts';
import ReactEcharts from 'echarts-for-react';
import React from 'react';

export default (props) => {
  const { height = '240px', data = [] } = props;
  const option = {
    tooltip: {
      trigger: 'item',
    },
    legend: {
      show: false,
    },
    series: [
      {
        type: 'pie',
        radius: '50%',
        data: data,
        label: {
          color: '#fff',
        },
        emphasis: {
          itemStyle: {
            shadowBlur: 10,
            shadowOffsetX: 0,
            shadowColor: 'rgba(0, 0, 0, 0.5)',
          },
        },
      },
    ],
  };

  return <ReactEcharts style={{ height, width: '100%' }} option={option} />;
};
